<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title> ${album.title} view</title>
</head>
<body>	
	
<a href="./LogoutController">Log out</a> <br/>
<a href="./editUser.jsp">Edit personal information</a> <br/>
<a href="./HomeController">Home</a> <br/>
	
	<h1> <c:out value="${album.title}" /> </h1>	
	
	<label> Description: <c:out value="${album.desription}" /> </label> <br />
	<label> Public: <c:out value="${album.publiclyAvailable}" /> </label> <br />
	
	
	<c:if test="${ favorites == false }">		
		<c:if test="${ requestScope.albumOwner.id eq sessionScope.user.id }"> <br/>		
			<a href="./PreChangeAlbumController?id=${album.id}"><button>Change album settings</button></a> <br/>
			<a href="./DeleteAlbumController?id=${album.id}"><button>Delete album</button> </a>
		</c:if>			
	</c:if>
	
		<c:if test="${ favorites == true }">		
		<c:if test="${ requestScope.albumOwner.id eq sessionScope.user.id }"> <br/>		
			<a href="./ChangeFavoritesVisibilityController?albumId=${album.id}&visible=${album.publiclyAvailable}"><button>Change favorites visibility</button> </a>
		</c:if>	
	</c:if>
	

	<c:if test="${not empty albumPhotos}">
		<table>
			<c:forEach var="photo" items="${albumPhotos}">
				<tr>
					<td><label> Photo title: </label></td>
					<td>
						<a href="./ViewPhotoController?id=${ photo.id }">
							<c:out value="${photo.title}" />
						</a>
					</td>
					<td> <img alt="Greška, nema slike" src="${ photo.thumbnailLocation }"> </td>				
				</tr>
			</c:forEach>
		</table>
	</c:if>
	
	<c:if test="${empty albumPhotos}">
		<h3>Album is empty!</h3>
	</c:if>
</body>
</html>